package top.kaoshanji.p2ch09a;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * 代码清单-p2ch09a-290页a：没有设置双亲类加载器对象的类加载器
 * author kaoshanji
 * ^_^
 * create time 2025/1/28 10:23
 */
public class NoParentClassLoader extends ClassLoader {

    private static final Logger logger = LogManager.getLogger(NoParentClassLoader.class);

    public NoParentClassLoader() {
        super(null);
    }

    public static void main(String[] args) throws ClassNotFoundException {
        logger.info("...代码清单-p2ch09a-290页a：没有设置双亲类加载器对象的类加载器...");

        NoParentClassLoader example = new NoParentClassLoader();
        logger.info("...ClassLoaderExample03的类加载器：{}...", NoParentClassLoader.class.getClassLoader());
        example.testLoad();
    }

    public void testLoad() throws ClassNotFoundException {
        loadClass("top.kaoshanji.p2ch09a.support.ToLoad");
    }


}
